-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add semantic conventions for process resource #635
Add semantic conventions for process resource #635
Conversation
7761a88
to
1de8bf1
Compare
|
635ab7c
to
f8b55b0
Compare
Please make sure to add an entry in the changelog: |
f679502
to
45f961f
Compare
45f961f
to
e2164c1
Compare
e2164c1
to
47c28ea
Compare
| process.executable_name | The name of the process executable. On Unix based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. | `otelcol` | See below | | ||
| process.executable_path | The full path to the process executable. On Unix based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. | `/usr/bin/cmd/otelcol` | See below | | ||
| process.command | The command used to launch the process (i.e. the command name). On Unix based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. | `cmd/otelcol` | See below | | ||
| process.commandline | The full command used to launch the process. This can be a nil- or space-delimited string. On Unix based systems, can be set to the full `proc/[pid]/cmdline` string. On Windows, can be set to the result of `GetCommandLineW`. | `cmd/otecol --config=config.yaml` | See below | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think using "nil" is clear here. Also, this is ambiguous. If I have only a single string with spaces but no nil, it is impossible to determine if I have some\ command\ with/spacesinpath
and no arguments, or a GetCommandLineW-encoded command line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also concern around using two different data types to represent the same attribute value: #635 (comment). It might create additional complexity on back end systems to have to manage potentially different data types for the same attribute, though I'm not sure how much of a concern this would be? I guess parsing null-characters on the back end would likely be equivalently complex.
Note this isn't strictly ambiguous btw. If that was a command with no arguments, and you were looking at the Unix representation, it would have a null-character as the last character in the string. On Windows it would not. Admittedly that is not a great representational difference, and could be difficult to distinguish in some programming languages.
After thinking about this some more, I think I do prefer the list of strings approach, but I'm not sure I'm aware of all the pros/cons. For now I have changed it back to that, and updated the example for each OS accordingly. But for the record here's the three options considered and pros/cons:
- Join arguments with a string:
Advantages: Most consistent representation across OSs.
Disadvantages: Potentially lossy/non-trivial conversion on Unix - do we need to enquote parameters with spaces in them (and escape internal quotes), etc? - Pass through string returned from OS as is (null-delimited on Unix):
Advantages: No processing needed by code producing telemetry, can just provide what OS returns.
Disadvantages: Back end needs to parse null-characters. - Convert to list of strings (for Unix only):
Advantages: Clean ("properly typed") representation.
Disadvantages: Inconsistent data type for the same attribute between OSs, and back end needs to handle this differently.
FYI @arminru note I've reverted the changes based on your last comment since you approved. Please take another look.
@igorpeshansky you may also be interested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly ps on Mac and Linux doesn't appear to apply any quoting so if there are spaces or quotes in in your argument (e.g. app --set "foo bar"
) ps doesn't appear to quote them. We could quote them (https://godoc.org/github.com/gonuts/go-shellquote#Join [1]). I can't think of any downsides in particular when it comes to filtering on quoted values. I think in most cases you're not going to be doing filtering on values that have quotes in them or other escaped characters. I imagine the common case is you're searching for commands that have basic things like "repl-factor" or some such in it.
[1] Not endorsing it, just searched for a shell escape library in go.
47c28ea
to
f11188f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In favor of the addition. Only questions are around specific naming, i.e. just bikeshedding.
| process.executable_name | The name of the process executable. On Unix based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. | `otelcol` | See below | | ||
| process.executable_path | The full path to the process executable. On Unix based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. | `/usr/bin/cmd/otelcol` | See below | | ||
| process.command | The command used to launch the process (i.e. the command name). On Unix based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. | `cmd/otelcol` | See below | | ||
| process.commandline | The full command used to launch the process. The value can be either a list of strings representing the ordered list of arguments, or a single string representing the full command. On Unix based systems, can be set to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. On Windows, can be set to the result of `GetCommandLineW`. | Unix: `[ cmd/otecol, --config=config.yaml ]`, Windows: `cmd/otecol --config=config.yaml` | See below | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually see commandline
as two words. Do we want to build naming hierarchy here as well? Or, just insert a separator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to process.command_line
for now. I'm not sure if process.command.name
would be a reasonable name for the "command"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM 👍
f11188f
to
66a9aa6
Compare
66a9aa6
to
66febc6
Compare
Adds semantic conventions for
process
as a resource which represents a regular operating system process.